package podologia;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import javax.swing.table.DefaultTableCellRenderer;

/**
 *
 * @author Mauricio
 */
class DateRenderer extends DefaultTableCellRenderer {

    private DateFormat formatter;
    private int Tipo;

    public DateRenderer(int Tipo) {
        this.Tipo = Tipo;
    }

    @Override
    public void setValue(Object value) {
        
            switch (Tipo) {
                case 1:
                    formatter = new SimpleDateFormat("dd/MM/yyyy kk:mm:ss");
                    setText((value == null) ? "" : formatter.format(value));
                    break;
                case 2:
                    setText((value == null) ? "" : (Float.toString(((Long) value) / 1000F / 60F)) + " Minutos");
                    break;
                case 3:
                    int dia = (Integer) value;
                    switch (dia) {
                        case 1:
                            setText("Domingo");
                            break;
                        case 2:
                            setText("Lunes");
                            break;
                        case 3:
                            setText("Martes");
                            break;
                        case 4:
                            setText("Miercoles");
                            break;
                        case 5:
                            setText("Jueves");
                            break;
                        case 6:
                            setText("Viernes");
                            break;
                        case 7:
                            setText("Sabado");
                            break;

                    }
                    break;
                    case 4:
                    formatter = new SimpleDateFormat("kk:mm");
                    setText((value == null) ? "" : formatter.format(value));
                    break;

            


        //formatter = DateFormat.getTimeInstance(DateFormat.DATE_FIELD);
        }

    }
}